import type {
  DictionaryEncoInfo,
  DictionaryEncoSaveOrUpdateParams,
} from '@/types'

const controller = getAjaxBaseUrl('/sysDictionaryEnco')

/** 新增或更新字典编码 */
export function saveOrUpdate(params: Partial<DictionaryEncoSaveOrUpdateParams>) {
  return post(`${controller}/saveOrUpdateDictionaryEnco`, params)
}

/** 根据字典分组Code查询字典编码列表 */
export function queryList(dicCode: string) {
  return get<DictionaryEncoInfo[]>(
    `${controller}/loadDicCodeByDictionaryEncoList`,
    { dicCode },
  )
}

/** 删除字典编码数据 */
export function deleteById(id: number) {
  return get(`${controller}/deleteDictionaryEnco`, { id })
}
